using UnityEngine;
using System.Collections;

public class _Player : MonoBehaviour {
	float f_jump;
	float f_gravity;
	
	public static float f_basejump = 0;
	public static float f_coins;
	
	public static bool b_gravity = true;
	
	
	void Start () 
	{
		gameObject.AddComponent("MeshRenderer");
		gameObject.AddComponent("MeshFilter");
				
		Mesh mesh = Quad.Create(3,5);
		gameObject.GetComponent<MeshFilter>().mesh = mesh;
		gameObject.GetComponent<MeshRenderer>().material.shader =(Shader) Resources.Load("Diffuse Detail");
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Material");
		gameObject.GetComponent<MeshRenderer>().material = (Material) Resources.Load("Outros/Transparent");
		gameObject.GetComponent<MeshRenderer>().material.mainTexture = (Texture) Resources.Load("Texturas/C_S");
	}
	
	void Update () 
	{
		#region gravidade, velocidade e pulo
		f_jump = f_basejump * Time.deltaTime * 2;
		f_basejump -= f_jump;
		
		
		#endregion

		#region sequencia de ifs para resolver fisicas e etc			

	 	if((Input.touchCount == 1 || Input.GetKeyDown(KeyCode.Space)) )
		{
			f_basejump = 15;
			Debug.Log (f_basejump);
		}
		
		
		
	/*	if(this.gameObject.transform.position.y <= 5 && f_jump == 0)
		{
			this.gameObject.transform.position = new Vector3 (this.gameObject.transform.position.x , 5 , 0);
		}*/
		#endregion
		
		transform.Translate(0, f_jump , 0);
	}

}
